#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/mman.h>
#include <fcntl.h>

#define err() do { perror("client1"); exit(EXIT_FAILURE); } while(0)

int main(int argc, char *argv[])
{
	int fid;
	char * data;
	if(( fid = open("shared", O_RDONLY)) < 0 ) err();
        if((data = (char*)mmap(NULL, 1024, PROT_READ, MAP_SHARED, fid, 0)) == MAP_FAILED) err();
	printf(data);
	if(munmap(data,1024) == -1) err();
	return 0;
}
